Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concept: functions #715

Merged
merged 4 commits into from
Jan 10, 2025
Merged

Concept: functions #715

merged 4 commits into from
Jan 10, 2025

Conversation

glennj
Copy link
Contributor

@glennj glennj commented Dec 20, 2024

Functions concept

@glennj glennj marked this pull request as draft December 20, 2024 23:23
@glennj glennj requested a review from a team December 20, 2024 23:23
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still in WIP/Draft state...

concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
function funcname { COMMANDS; }
```

There is no difference between the two styles.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we recommend the portable syntax?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal preference, based on my time in the IRC channel, is for the portable version.

Mentioning two approaches without any suggestion in one direction or the other can leave someone new to the syntax a bit ... confused/adrift about which to use.

concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Show resolved Hide resolved
function funcname { COMMANDS; }
```

There is no difference between the two styles.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal preference, based on my time in the IRC channel, is for the portable version.

Mentioning two approaches without any suggestion in one direction or the other can leave someone new to the syntax a bit ... confused/adrift about which to use.

```
~~~~

## Return Value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A function call has one return value. A function can have many calls and many return values.

A function variable has one name and one value (at any given time).

It feels very odd to me for them to be inconsistent.

concepts/functions/introduction.md Outdated Show resolved Hide resolved
concepts/functions/introduction.md Outdated Show resolved Hide resolved
## Recursion

Functions can call themselves recursively.
By default, there is no limit to the depth of recursion.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No recursion limit ... but factorials would overflow pretty quickly 😄

@glennj glennj marked this pull request as ready for review December 27, 2024 16:06
@glennj
Copy link
Contributor Author

glennj commented Dec 27, 2024

Regarding the 2 ways to define a function, I simply removed one of them. Frustratingly even the google shell style guide mixes the styles.

concepts/functions/about.md Outdated Show resolved Hide resolved
@glennj glennj changed the title WIP Concept: functions Concept: functions Jan 4, 2025
@glennj glennj force-pushed the concept-functions branch from d831165 to f72a5cf Compare January 9, 2025 16:34
@glennj glennj merged commit c8298b0 into exercism:main Jan 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants